package com.eagle.demo.controller;

import com.eagle.core.annotation.SelfAutowired;
import com.eagle.core.annotation.SelfController;
import com.eagle.core.annotation.SelfRequestMapping;
import com.eagle.core.annotation.SelfRequestParam;
import com.eagle.core.bean.SelfResponse;
import com.eagle.core.bean.View;
import com.eagle.demo.bean.UserInfo;
import com.eagle.demo.service.DemoService;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

@SelfController
@SelfRequestMapping("/aop")
public class AopDemoController {
	@SelfAutowired private DemoService demoService;

//	http://localhost:8081/aop/test?name=eagle
	@SelfRequestMapping("/test")
	public SelfResponse query(HttpServletRequest req, HttpServletResponse resp, @SelfRequestParam("name") String name){
		UserInfo userInfo = demoService.get(name);
		SelfResponse response = new SelfResponse(userInfo);
		return response;
	}

}
